package com.docker.sys.menu;

import com.docker.core.constant.APPIDConstant;
import com.docker.core.mvc.APPID;
import com.docker.core.mvc.Remark;
import com.docker.core.mvc.controller.BaseAPIController;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Okv;

/**
 * @Author ldl
 * @Create 2020/09/18 018 09:55
 */
@Remark("系统菜单管理")
@APPID(APPIDConstant.dum_web)
public class MenuController extends BaseAPIController {

    @Inject
    private MenuService menuService;

    /**
     * @Param: []
     * @return: TODO
     * @Author: ldl
     * @Create: 2020/09/18 018 13:42
     */
    @Remark("菜单列表")
    public void tree() {
        Okv cond = Okv.create()
                .set("m.app_id = ", getPara("app_id"));
        renderAPISuccess(menuService.tree(Okv.by("cond", cond)));
    }

    /**
     * @Param: []
     * @return: TODO
     * @Author: ldl
     * @Create: 2020/09/18 018 13:42
     */
    @Remark("新增菜单")
    public void save() {
        renderAPI(menuService.save(getBean(MenuBean.class, ""), getUserId()));
    }

    /**
     * @Param: []
     * @return: TODO
     * @Author: ldl
     * @Create: 2020/09/18 018 14:05
     */
    @Remark("修改菜单")
    public void update() {
        renderAPI(menuService.update(getBean(MenuBean.class, ""), getUserId()));
    }

    /**
     * @Param: []
     * @return: TODO
     * @Author: ldl
     * @Create: 2020/09/18 018 14:12
     */
    @Remark("启用菜单")
    public void enable() {
        renderAPI(menuService.enable(getPara("menu_id"), getUserId()));
    }

    /**
     * @Param: []
     * @return: TODO
     * @Author: ldl
     * @Create: 2020/09/18 018 14:14
     */
    @Remark("停用菜单")
    public void disable() {
        renderAPI(menuService.disable(getPara("menu_id"), getUserId()));
    }

}
